import request from '@/utils/request.js'
import { useAccountStore } from '@/stores/account'
import { storeToRefs } from 'pinia'

export function requirements(data) {
  return request.post('/lm/lm-requirements', data)
}
export function requirements2(data) {
  let accountStore = useAccountStore()
  let account = storeToRefs(accountStore)
  return fetch(
    (!APP_MOCK_ENABLE ? import.meta.env.VITE_APP_API_BASE || '' : '') +
      `/data/ed/ai/chatStreamResp`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Accept: 'text/event-stream',
        Authorization: 'Bearer ' + account.token.value,
      },
      body: JSON.stringify(data),
    },
  )
}
export function uploadFile(formData) {
  return request.post('/data/ed/ai/upload', formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })
}
